﻿using System;
using System.Windows.Input;

namespace ServiceLayerManagement.Tool
{
    public class EnableControlCommand : ICommand
    {
        private readonly Action<bool> _execute;

        public event EventHandler CanExecuteChanged;

        public EnableControlCommand(Action<bool> execute)
        {
            _execute = execute;
        }

        public bool CanExecute(object parameter)
        {
            return true; // 可以根据需要更改使能条件
        }

        public void Execute(object parameter)
        {
            _execute?.Invoke(true); // 执行控制主窗体控件使能的逻辑，这里将参数设为 true
        }
    }
}
